package xyz.syyrjx.provider.conf;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import xyz.syyrjx.entity.SyyrjxRpcRemoteAddress;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author 大地崩坏苍蝇兽
 * @date 2023/1/14 - 21:14
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ConfigurationProperties("xyz.syyrjx.rpc.provider")
public class SyyrjxRpcProviderConfiguration {

    private String[] registryAddress = new String[0];

    private String host = "localhost";

    private int port;

    private int maxReadSize = 4 * 1024;

    private int heartBeatInterval = 5000;

    private static SyyrjxRpcProviderConfiguration configuration;

    private static SyyrjxRpcRemoteAddress local;

    public static SyyrjxRpcProviderConfiguration getConfiguration() {
        return configuration;
    }

    public static void setConfiguration(SyyrjxRpcProviderConfiguration configuration) {
        SyyrjxRpcProviderConfiguration.configuration = configuration;
    }

    public static SyyrjxRpcRemoteAddress getLocal() {
        return local;
    }

    public static void setLocal(SyyrjxRpcRemoteAddress local) {
        SyyrjxRpcProviderConfiguration.local = local;
    }
}
